package jdl.databaseObjects;

public class FieldCollection extends DbCollection<DbField> {
	private Table table;

	public FieldCollection(Table table) {
		if (table == null)
			throw new IllegalArgumentException("table is null.");
		this.table = table;
	}

	@Deprecated
	public void addField(DbField field) {
		addObject(field);
		field.setFieldCollection(this);
	}

	public DbField getFieldByName(String name) {
		return getObjectByName(name);
	}

	@Override
	public void add(DbField field) throws ObjectAlreadyExistsException {
		super.add(field);
		field.setFieldCollection(this);
	}

	public Table getTable() {
		return table;
	}
}
